package net.yla.smartbus.core.util;

import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * 将厘转换为元
 * @author ZengXiaoLiang
 * @date 2019/1/8 19:39
 */
public class SeocooMoneyUtil {
	public static BigDecimal li2yuan(BigDecimal num) {
		return num.divide(new BigDecimal(1000), 2, RoundingMode.HALF_UP);
	}

	public static BigDecimal li2yuan(long num) {
		return li2yuan(new BigDecimal(num));
	}

	public static BigDecimal li2yuan(String num) {
		return StringUtils.isEmpty(num) ? new BigDecimal(0) : li2yuan(new BigDecimal(num));
	}
}
